package fapai;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: dell
 * Date: 2023-12-12
 * Time: 14:51
 */
public class test1 {
    public static void main(String[] args) {
        List<pai> list =new ArrayList<>();
        String[] strings=new String[]{"♣","♥","♠","♦"};
        //存52张牌
        for (int i=0;i<strings.length;i++){
            for (int j=1;j<=13;j++){
                pai pai1=new pai(strings[i],j);
                list.add(pai1);
            }
        }
        System.out.println(list);
        Random random=new Random();
        for (int i=51;i>0;i--){
            int j= random.nextInt(i);
            pai tmp=list.get(j);
            list.set(j,list.get(i));
            list.set(i,tmp);
        }
        System.out.println(list);
        List<pai> hand1 =new ArrayList<>();
        List<pai> hand2 =new ArrayList<>();
        List<pai> hand3 =new ArrayList<>();
        List<List<pai>> hands=new ArrayList<>();
        hands.add(hand1);
        hands.add(hand2);
        hands.add(hand3);
        //3个人，每个人轮流揭牌5张
        for (int i=0;i<5;i++){
            for (int j=0;j<3;j++){
                //揭牌的动作
                pai tmppai=list.remove(0);
                //如何翻到指定的人的手里呢？？
                hands.get(j).add(tmppai);
            }
        }
        System.out.println(list);
        System.out.println(hands);
    }
}